Replay Playback
Overview
Feed.fm Replay is a product that allows users to select songs from a catalog of independent label content to create a playlist that plays in the same order every time it's heard alongside your content.
It is designed for those who want to easily incorporate music into apps or content soundtracks and stream globally. It's an ideal solution for anyone tired of navigating extensive production music catalogs or settling for royalty-free options, offering a quicker way to access quality music that matches any vibe.
Replay stations are an extention of First play stations. The main difference being that replay station can be replayed multiple times in the exact same order unlike first play which can only be played back in a specific order once.
Current Features included:
- Browse Collections
- Track Search
- Soundslike Search and Genre Selection with BPM and Duration Filters
- Spotify Importer SoundsLike
This guide walkes through client side integration on iOS and Android. A replay station has a few additional features and potential pitfalls compared to a regular radio station. This guide will help you fully utilize all the features and avoid implementation issues. We recommend reading this guide in its entirety before beginning the implementation.
Initialization
Initialize the FeedAudioPlayer. Once the player is available and ready, fetch the correct Replay station.
- Kotlin
- Objective-C
new FeedAudioPlayer.Builder(getApplicationContext(), "demo", "demo").
setAvailabilityListener(new AvailabilityListener() {
@Override
public void onPlayerAvailable(@NonNull FeedAudioPlayer player) {
// The player is now ready, save its reference for later use
mPlayer = player;
StationList list = player.getStationList()
Station replayStation = list.getStationWithOption("uuid", "myuniqueReplaystationid")
}
@Override
public void onPlayerUnavailable(@NonNull Exception e) {
// The player is not available, either the user does not have a correct location
// or the feed servers could not be reached.
}
}).build();
[FMAudioPlayer setClientToken:@"demo" secret:@"demo"];
Listen for when the player is available.
FMAudioPlayer *player = [FMAudioPlayer sharedPlayer];
[player whenAvailable:^{
NSLog(@"Player is available");
FMStation * station = [player.stationList getStationWithOptionKey:@"uuid" Value:@"my-unique-FirstPlay-station-id"];
} notAvailable:^{
NSLog(@"Player is not available");
}];
The next step is to correctly set this station. This is done via setActiveStation
call where advanceby parameter must be set to 0. If the advanceBy
is a positive number the station will skip ahead to the given time. If advanceBy
parameter is not set the station will behave like a DMCA station.
The value of advanceBy
must only be set to 0 for replay stations, if 0 is passed for first play/DMCA stations, the SDK will throw an error and music may not start.
- Kotlin
- Objective-C
mPlayer.setActiveStation(station = station, withCrossfade = false, advanceBy = 0f)
// Call play
mPlayer.play()
[[FMAudioPlayer sharedPlayer] setActiveStation:station withAdvance:0];
// Call play
[[FMAudioPlayer sharedPlayer] play];
Calling setActiveStation
on the same station with and without the advanceBy
parameter in quick succession can cause unexpected behavior.
The value of advanceBy
must be set to 0 if you wish to replay the station from beginning.
If advancyBy
is not set and the station has already been played back for a given client_id, attempting to call play on the given station will trigger an outOfMusic()
callback. We recommend you listen for this event using the OutOfMusicListener
and
The Station
object exposes single_play
and last_played
parameters for First Play and replay stations. These two parameters can help in identifying if a station has already been played back or not.